<?php
echo $javascript->codeBlock("
	$(document).ready(function(){
		$('input#id_search').quicksearch('table#table_users_list tbody tr');
	});		
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>


<div class="main_body">
	<div id="left_column">
    <?php echo $this->element('main_menu')?>		
  	<?php echo $this->element('/customers/search_form')?>
    </div>			
	<div id="main_body_content">


			<div class="customers index">
				<h1><?php __("Customers");?></h1>

				<table cellpadding="0" cellspacing="0"  id="table_users_list">
				<thead>
				<tr>
						<th><?php echo $this->Paginator->sort('name');?><br/>
							<?php echo $this->Paginator->sort('surname');?></th>
						<th><?php echo $this->Paginator->sort('address1');?>
							</br>
							<?php echo $this->Paginator->sort('address2');?></th>
						<th><?php echo $this->Paginator->sort('phone1');?></th>
						<th class="actions"><?php __("Actions");?></th>
				</tr>
				</thead>
				<tbody>
				<?php
				$i = 0;
				foreach ($customers as $customer):
					$class = null;
					if ($i++ % 2 == 0) {
						$class = ' class="altrow"';
					}
				?>
				<tr<?php echo $class;?>>
					<td><?php echo $customer['Customer']['name']; ?>&nbsp;<br/>
						<?php echo $customer['Customer']['surname']; ?>&nbsp;</td>
					<td><?php echo $customer['Customer']['address1']; ?>&nbsp;<br/>
						<?php echo $customer['Customer']['address2']; ?>&nbsp;</td>
					<td><?php echo $customer['Customer']['phone1']; ?>&nbsp;</td>
					<td class="actions">
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_message_send.png'), array('controller'=>'messages','action' => 'add', $customer['User']['id']),array('escape'=>false,'title'=>__("Send Email", true))); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_view.png'), array('action' => 'view', $customer['Customer']['id']),array('escape'=>false,'title'=>'View')); ?> 
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_edit.png'), array('action' => 'edit', $customer['Customer']['id']),array('escape'=>false,'title'=>'Edit')); ?> 
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_delete.png'), array('action' => 'delete', $customer['Customer']['id']), array('escape'=>false,'title'=>'Delete'), sprintf(__("Are you sure you want to delete # %s?", true), $customer['Customer']['id'])); ?>
					</td>
				</tr>
			<?php endforeach; ?>
				</tbody>
				</table>
				<form action="#">
					<fieldset>
						<legend><h1><?php __("Filtering"); ?></h1></legend>
						<div class="input text required">
						<label for="search"><?php __("Szukaj")?></label>
						<input type="text" name="search" value="" id="id_search" placeholder="Search" autofocus=""/>
						</div>
					</fieldset>
				</form>
				
				<p>
				<?php
				echo $this->Paginator->counter(array(
				'format' => __("Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%", true)
				));
				?>	</p>
			
				<div class="paging">
					<?php echo $this->Paginator->prev('<< ' . __("previous", true), array(), null, array('class'=>'disabled'));?>
				 | 	<?php echo $this->Paginator->numbers();?>
			 |
					<?php echo $this->Paginator->next(__("next", true) . ' >>', array(), null, array('class' => 'disabled'));?>
				</div>
			</div>		
		
		<div class="clr"></div>	
	</div>	
		
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>


</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">
	
		<div class="actions">
			<h2><?php __("Actions"); ?></h2>
			<ul>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_customer_add.png'), array('action' => 'add'),array('escape'=>false,'title'=>__("Add Customer",true))); ?><div class="clr"></div><?php echo __("Add Customer",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_list.png'), array('controller' => 'orders', 'action' => 'index'),array('escape'=>false,'title'=>__("List Orders", true))); ?><div class="clr"></div>	<?php echo __("List Orders", true)?> </li>									
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_services.png'), array('controller' => 'type_of_services', 'action' => 'index'),array('escape'=>false,'title'=>__("List Type Of Services",true))); ?><div class="clr"></div> <?php echo __("List Type Of Services",true)?> </li>				
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_spaces.png'), array('controller' => 'types_of_spaces', 'action' => 'index'),array('escape'=>false,'title'=>__("List Types Of Spaces", true))); ?> <div class="clr"></div>	<?php echo __("List Types Of Spaces", true)?></li>				
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_employees.png'), array('controller' => 'employees', 'action' => 'index'),array('escape'=>false,'title'=>__("List Employees", true))); ?> <div class="clr"></div> <?php echo __("List Employees", true)?></li>
				
			</ul>
		</div>	
		
		<div class="clr"></div>					
	</div>		
</div>